import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import 'package:get/get.dart';
import 'package:page_view_dot_indicator/page_view_dot_indicator.dart';

import '../../../style/app_colors.dart';
import '../controllers/action_squares_controller.dart';
@deprecated
class ActionSquaresView extends GetView<ActionSquaresController> {
  ActionSquaresView({super.key});



  @override
  Widget build(BuildContext context) {
      return Scaffold(
        appBar: AppBar(
            title: const Text('动作广场'),
            centerTitle: true,
            leading: IconButton(
              icon: Image.asset('assets/images/ic_back2.png',width: 48.w,height: 48.h),
              onPressed: () {
                Get.back();
              },
              tooltip: MaterialLocalizations.of(context).backButtonTooltip, // 可选：设置工具提示
            ),
            bottom: controller.robotWhetherOnline.value ? PreferredSize(preferredSize: Size.fromHeight(0.h),child: SizedBox()): PreferredSize(
              preferredSize: Size.fromHeight(72.h),
              child: Container(
                padding: EdgeInsets.only(top: 18.h, bottom: 13.h,left: 40.w),
                color: AppColors.warning_tip_bgColor,
                width: MediaQuery.of(context).size.width,
                child: Text('机器人已经离线,无法执行动作.',style: TextStyle(fontSize: 26.sp,color: Colors.red),),
              ),
            )
        ),
        body: Obx(()=>Container(
          width: MediaQuery.of(context).size.width,
          child: Column(
            children: [
              Expanded(
                  flex: 1,
                  child: Image.asset('assets/images/ic_dance_default.webp',width: 540.w,height: 460.h)),
              Text('点击下方按钮,就能让悟空动起来！',style: TextStyle(fontSize: 30.sp,color: AppColors.Sub_Title_Color)),
              Expanded(
                  flex: 1,
                  child: Container(
                    child: Obx(()=>PageView.builder(
                      controller: controller.pageController.value,
                      itemCount: controller.totalPages.value,
                      itemBuilder: (context, index) {
                        controller.currentPage.value = index;
                        return Center(
                          child: Text('Page ${index+1}'),
                        );
                      },
                      onPageChanged: (index) {
                        controller.setCurrentPage(index);
                      },
                    )),
                  )
              ),
              Padding(
                padding: const EdgeInsets.symmetric(horizontal: 24),
                child: PageViewDotIndicator(
                  currentItem: controller.getCurrentPage(),
                  count: controller.getTotalPage(),
                  unselectedColor: Colors.black26,
                  selectedColor: Colors.blue,
                  duration: const Duration(milliseconds: 200),
                  boxShape: BoxShape.circle,
                  size: Size(9.w, 9.h),

                ),
              ),
              SizedBox(height: 59.h,),
              Text('注意让悟空保持在安全平整的地方运动,以免磕碰或跌落！',style: TextStyle(fontSize: 24.sp,color: AppColors.Sub_Title_Color)),
              SizedBox(height: 47.h,),
            ],
          ),
        )),
      );
  }
}
